/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.kungkhies.persistence.entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author clayton
 */
@Entity 
@Table(name = "ilo")
@XmlRootElement
@NamedQueries(
{
    @NamedQuery(name = "Ilo.findAll", query = "SELECT i FROM Ilo i"),
    @NamedQuery(name = "Ilo.findByIloId", query = "SELECT i FROM Ilo i WHERE i.iloId = :iloId"),
    @NamedQuery(name = "Ilo.findByPackage1", query = "SELECT i FROM Ilo i WHERE i.package1 = :package1"),
    @NamedQuery(name = "Ilo.findByIloText", query = "SELECT i FROM Ilo i WHERE i.iloText = :iloText"),
    @NamedQuery(name = "Ilo.findByNote", query = "SELECT i FROM Ilo i WHERE i.note = :note")
})
public class Ilo implements Serializable 
{
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ilo_id")
    private Long iloId;
    @Size(max = 1024)
    @Column(name = "package")
    private String package1;
    @Size(max = 2048)
    @Column(name = "ilo_text")
    private String iloText;
    @Size(max = 1024)
    @Column(name = "note")
    private String note;
    @ManyToMany(mappedBy = "iloCollection")
    private Collection<Activity> activityCollection;
    @ManyToMany(mappedBy = "iloCollection")
    private Collection<Knode> knodeCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "iloId")
    private Collection<IloCanonical> iloCanonicalCollection;

    public Ilo()
    {
    }

    public Ilo(Long iloId)
    {
        this.iloId = iloId;
    }

    public Long getIloId()
    {
        return iloId;
    }

    public void setIloId(Long iloId)
    {
        this.iloId = iloId;
    }

    public String getPackage1()
    {
        return package1;
    }

    public void setPackage1(String package1)
    {
        this.package1 = package1;
    }

    public String getIloText()
    {
        return iloText;
    }

    public void setIloText(String iloText)
    {
        this.iloText = iloText;
    }

    public String getNote()
    {
        return note;
    }

    public void setNote(String note)
    {
        this.note = note;
    }

    @XmlTransient
    public Collection<Activity> getActivityCollection()
    {
        return activityCollection;
    }

    public void setActivityCollection(Collection<Activity> activityCollection)
    {
        this.activityCollection = activityCollection;
    }

    @XmlTransient
    public Collection<Knode> getKnodeCollection()
    {
        return knodeCollection;
    }

    public void setKnodeCollection(Collection<Knode> knodeCollection)
    {
        this.knodeCollection = knodeCollection;
    }

    @XmlTransient
    public Collection<IloCanonical> getIloCanonicalCollection()
    {
        return iloCanonicalCollection;
    }

    public void setIloCanonicalCollection(Collection<IloCanonical> iloCanonicalCollection)
    {
        this.iloCanonicalCollection = iloCanonicalCollection;
    }

    @Override
    public int hashCode()
    {
        int hash = 0;
        hash += (iloId != null ? iloId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object)
    {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Ilo))
        {
            return false;
        }
        Ilo other = (Ilo) object;
        if ((this.iloId == null && other.iloId != null) || (this.iloId != null && !this.iloId.equals(other.iloId)))
        {
            return false;
        }
        return true;
    }

    @Override
    public String toString()
    {
        return "com.kungkhies.persistence.entities.Ilo[ iloId=" + iloId + " ]";
    }

}
